﻿@model Forum
@{ 
    var isGroup = Model != null ? Model.IsGroup : (bool)ViewData["IsGroup"];
}
<input name="Forum.IsGroup" value="@isGroup" type="hidden" />
<input id="__forum_id" value="@(Model != null ? Model.ID : 0)" type="hidden" />
<table class="d-field-table" cellspacing="0" style="border: 1px solid #cccccc;">
    <tr>
        <td colspan="2">@Html.ValidationSummary()
        </td>
    </tr>
    <tr>
        <td>
            <h3 class="d-field-title">
                @Html.Global("RES_TITLE")</h3>
            <div class="d-field-description">
                @Html.Global("forums", "ForumTitleTips")
            </div>
        </td>
        <td>
            @Ajax.DnaFor().TextBox(m => m.Title).Width(300).GetHtml()
            @Html.ValidationMessageFor(m => m.Title)
        </td>
    </tr>
    <tr>
        <td>
            <h3 class="d-field-title">
                @Html.Global("RES_DESC"):</h3>
            <div class="d-field-description">
                @Html.Global("forums", "ForumDescTips")
            </div>
        </td>
        <td>
            @Ajax.DnaFor().TextArea(m => m.Description).Width(300).GetHtml()
        </td>
    </tr>
    @if (!isGroup)
    {
        <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "Image")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "ForumImage_Tips")
                </div>
            </td>
            <td>
                <table>
                    <tr>
                        <td style="padding-right: 0px; padding-left: 0px; border: none;">
                            @Ajax.DnaFor().TextBox(m => m.ImageUrl).Width(300).GetHtml()
                        </td>
                    </tr>
                    <tr>
                        <td style="padding: 0px;">@Ajax.Dna().Button("btnBrowseLogo").LocText("RES_BROWSE").Click("_fileDlg(\"#Forum_ImageUrl\");").ImageIcons(Url.Content("~/content/images/icon_folder_open_16.gif")).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
        <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "Lock")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "ForumLockTips")
                </div>
            </td>
            <td>
                @Ajax.Dna().Checkbox("Forum.IsLocked", Html.Global("forums", "IsLockForum"), Model != null ? Model.IsLocked : false,
                   Url.Content("~/content/images/icon_accept_16.png"),
                   Url.Content("~/content/images/icon_block_16.png")).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "Moderated")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "ForumModerateTips")
                </div>
            </td>
            <td>
                @Ajax.Dna().Checkbox("Forum.IsModerated", Html.Global("forums", "IsModerated"), Model != null ? Model.IsModerated : false,
                   Url.Content("~/content/images/icon_accept_16.png"),
                   Url.Content("~/content/images/icon_block_16.png")).GetHtml()
            </td>
        </tr>    <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "ForumAllowAnonymous")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "ForumAllowAnonymousTips")
                </div>
            </td>
            <td>
                @Ajax.Dna().Checkbox("Forum.AllowAnonymous", Html.Global("forums", "ForumAllowAnonymous"), Model != null ? Model.AllowAnonymous : false,
                   Url.Content("~/content/images/icon_accept_16.png"),
                   Url.Content("~/content/images/icon_block_16.png")).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "AllowAttachments")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "AllowAttachmentsTips")
                </div>
            </td>
            <td>
                @Ajax.Dna().Checkbox("Forum.AllowAttachment", Html.Global("forums", "AllowAttachments"), Model != null ? Model.AllowAttachment : true,
                   Url.Content("~/content/images/icon_accept_16.png"),
                   Url.Content("~/content/images/icon_block_16.png")).GetHtml()
            </td>
        </tr>
        <tr>
            <td>
                <h3 class="d-field-title">
                    @Html.Global("forums", "Moderators")</h3>
                <div class="d-field-description">
                    @Html.Global("forums", "ForumModeratorsTips")
                </div>
            </td>
            <td>
                @{ var _mods = "";}
                @if ((Model != null) && Model.ID > 0)
                {
                    if (Model.Moderators.Count > 0)
                    {
                        _mods = string.Join(",", Model.Moderators.Select(m => m.UserName).ToArray());
                    }
                }
                @Ajax.Dna().TextBox("Moderators").AutoComplete(Url.Action("GetSuggests", "Account", new { Area = "" }), true).Value(_mods).Width(300).GetHtml()
            </td>
        </tr>
    }
</table>
@Html.StartupScripts()
<script type="text/javascript">
    function _fileDlg(_el) { 
      $dna.fileDlg("@Url.Action("Dialog", "WebFiles", new { Area = "", website = WebSiteContext.Current.Web.Name })", _el);
    }
</script>
